<?php if (!defined("_ECRIRE_INC_VERSION")) return; if (class_exists('ArticleSimilarModel')) return;
/**
 * EcataloguE
 *
 * @author     Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 * @license    GNU/GPL
 * @package    plugins
 * @subpackage ecatalogue
 * @copyright  (c) Aleksey Yaroshchuk 2011-2012
 * @link       http://www.spip-contrib.net/EcataloguE
 */

/**
 *  ArticleSimilarModel class 
 *
 *  @author Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com) 
 */
include_spip('classes/pdk_model'); 
class ArticleSimilarModel extends pdk_Model {   
    
    public function __construct() {
        parent::__construct();
        $this->config_model();
    }
    
    function config_model() {
        // Define main table:
        $this->main_table = 'spip_ecatalogue_articles_similars';
        
        // Define primary key:
        $this->primary_key = 'id_article';
        
        // Define main table fields:
        $this->main_fields['id_article'] = 'id_article';
        $this->main_fields['id_similar'] = 'id_similar';
                                                                                 
         // Define validation rules:
         $this->validation->set_rules( 
            array(
                array(
                     'field'   => 'id_article',
                     'label'   => 'ID article',
                     'rules'   => 'required'
                  ),  
                array(
                     'field'   => 'id_similar',
                     'label'   => 'ID similar',
                     'rules'   => 'required'
                  )
            )
         );                                       
    }
    
    // Define test data
    public $test_data = array(
        array('id_article'=>1,'id_similar'=>2),
        array('id_article'=>1,'id_similar'=>3),
        array('id_article'=>2,'id_similar'=>3),
        array('id_article'=>2,'id_similar'=>4)
        );
} 
?>